#include "label.h"
#include <QDebug>
#include <QMouseEvent>

Label::Label(QWidget *parent) : QLabel(parent)
{

}

void Label::mousePressEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() <<"press leftButton";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() <<"press rightButton";
    }
    qDebug() <<"press: "<< ev->x() << "," << ev->y();
    qDebug() <<"press: "<< ev->globalX() << "," << ev->globalY();
}

void Label::mouseReleaseEvent(QMouseEvent *ev)
{
    qDebug() <<"release: "<< ev->x() << "," << ev->y();
    qDebug() <<"release: "<< ev->globalX() << "," << ev->globalY();
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() <<"release leftButton";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() <<"release rightButton";
    }
}

void Label::mouseDoubleClickEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() <<"double press leftButton";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() <<"double press rightButton";
    }
}


